package ru.arriah.servicedesk.bean;

import java.sql.ResultSet;
import java.sql.SQLException;

public class EmployeeBean extends UserBean {
  
   private int groupId;
   private int typeId;     
   private GroupBean group;
   private EmployeeTypeBean type;
   
   public EmployeeBean() {
     super();
   }     
   
   public EmployeeBean(ResultSet resultSet) {
      super();
      fillFromResultSet(resultSet);
    }
   
//   public EmployeeBean(ResultSet resultSet, String tableAlias) {
//      super(resultSet, tableAlias);
//      
//      
//   }
   
   public void fillFromResultSet(
      ResultSet resultSet   
   ) {
      this.fillFromResultSet(resultSet, "user");
   }
   
   public void fillFromResultSet(
      ResultSet resultSet, 
      String table
   ) {
      super.fillFromResultSet(resultSet, table);
      
      try {
         setGroupId(resultSet.getInt("employee_settings.group_id"));
         setTypeId(resultSet.getInt("employee_settings.employeetype_id"));
      } catch (SQLException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }      
   }
   
//   public EmployeeBean(ResultSet resultSet) {
//      this(resultSet, "user");
//   }   
   
   public GroupBean getGroup() {
      return group;
   }
   
   public void setGroup(GroupBean group) {
      this.group = group;
   }
   
   public int getGroupId() {
      return groupId;
   }
   
   public void setGroupId(int groupId) {
      this.groupId = groupId;
   }
   
   public EmployeeTypeBean getType() {
      return type;
   }
   
   public void setType(EmployeeTypeBean type) {
      this.type = type;
   }
   
   public int getTypeId() {
      return typeId;
   }
   
   public void setTypeId(int typeId) {
      this.typeId = typeId;
   }    
}